package org.springframework.example.aop.config;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.example.aop.service.AccountService;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@ComponentScan("org.springframework.example.aop")
@EnableAspectJAutoProxy
@EnableTransactionManagement
public class AppConfig {




	@Bean
	public BeanNameAutoProxyCreator beanNameAutoProxyCreator(){
		BeanNameAutoProxyCreator aop = new BeanNameAutoProxyCreator();
		aop.setBeanNames("account*");
		aop.setInterceptorNames("myBeforeAdvice");
		aop.setProxyTargetClass(true);
		return aop;
	}


}
